package cm309.BookingSystem.FM;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.h2.engine.ConnectionInfo;

import com.fasterxml.jackson.databind.util.ArrayBuilders.IntBuilder;

	public class  factitiesDetailHander extends HttpServlet {

		@Override
		protected <HttpServletRequest> void doGet(HttpServletRequest req, HttpServletRequest resp)
				throws ServletException, IOException {
			int id = IntBuilder.valueOf(req.getParameter("id"));
			try {
				Connection conn = null;
				try {
					conn = factilitiesDao.getConnection();
					PreparedStatement ps;
					ps = conn.prepareStatement("DELETE FROM BK_FM_MemberID WHERE ID=?");
							
					ps.setInt(1, id);
					

					int count = ps.executeUpdate();
					conn.commit();
					RequestDispatcher dispatcher = req.getRequestDispatcher("FactitiesResult.html");
					dispatcher.forward(req, resp);
				}catch (SQLException e) {
					conn.rollback();
					e.printStackTrace();
					
				}finally {
					conn.close();
				}
				
			}catch (Exception e){
				e.printStackTrace();
			}			
		}
